package com.ease.map.control.basemaptool {
   import com.ease.map.Map;
   import com.ease.map.control.basemaptool.dock.Dock;
   import com.ease.map.control.basemaptool.dock.DockItem;
   import com.ease.map.control.basemaptool.dock.DockLabel;

   import mx.collections.ArrayCollection;
   import mx.core.ClassFactory;
   import mx.events.CollectionEvent;
   import com.ease.map.control.basemaptool.AbstractBaseMapTool;

   public class BaseToolControl extends Dock {
      private var tools:ArrayCollection;
      [Bindable]
      private var _itemRenderer:ClassFactory = new ClassFactory(DockItem);
      [Bindable]
      private var _labelRenderer:ClassFactory = new ClassFactory(DockLabel);
      private var _map:Map;

      public function BaseToolControl() {
         super();
         this.setStyle('minimumSize', 64);
         this.setStyle('maximumSize', 96);
         this.setStyle('scaleRange', 100);
         this.setStyle('labelPosition', 'top');
         //this.setStyle('labelPosition', 'right');
         this.setStyle('horizontalLabelAlign', 'center');
         this.setStyle('labelGap', 5);
         this.setStyle('labelAppearanceDelay', 0);
         this.setStyle('horizontalAlign', 'center');
         this.setStyle('verticalAlign', 'bottom');
         this.setStyle('paddingBottom', 5);
         this.setStyle('horizontalGap', 5);

         tools = new ArrayCollection();

         this.visible = true;
         super.itemRenderer = _itemRenderer;
         super.labelRenderer = _labelRenderer;
         super.labelField = "toolTip";
         super.dataProvider = tools;
      }

      public function set map(value:Map):void {
         this._map = value;
      }

      public function get map():Map {
         return this._map;
      }

      public function addTool(tool:AbstractBaseMapTool):void {
         tool.map = this._map;
         this.tools.addItem(tool);

      }

   }
}